package com.fire.activiti.activitidb.process.impl;

import com.fire.activiti.activitidb.process.DeployService;
import com.fire.activiti.activitidb.process.HistoryService;
import com.fire.activiti.activitidb.process.ProcessEngine;
import com.fire.activiti.activitidb.process.RunTimeService;

/**
 * @author Mr.Fire
 * @date 2021/12/21
 * @desc activiti6流程引擎
 */
public class Activiti6ProcessEngine implements ProcessEngine {


    private org.activiti.engine.ProcessEngine processEngine;

    private final RuntimeServiceImpl runtimeService;

    private final DeployServiceImpl deployService;

    private final HistoryService historyService;

    public Activiti6ProcessEngine(org.activiti.engine.ProcessEngine processEngine) {
        this.processEngine = processEngine;
        this.deployService =  new DeployServiceImpl(processEngine);
        this.runtimeService =  new RuntimeServiceImpl(processEngine,deployService);
        this.historyService =  new HistoryServiceImpl(processEngine);
    }

    @Override
    public RunTimeService getRuntimeService() {
        return runtimeService;
    }

    @Override
    public HistoryService getHistoryService() {
        return historyService;
    }

    @Override
    public DeployService getDeployService() {
        return deployService;
    }

    public void destory(){
        processEngine.close();
    }
}
